<?php
/**
 * Context
 *
 * The scope of a variable is the context within which it is defined.
 * For the most part all variables only have a single scope.
 * This single scope spans included and required files as well.
 *
 * @author  Badrus Said <badrus.said@gmail.com>
 * @since   gop1.0
 */
final class gop_Context {
    static private $context = array();
    static public function getContext($name) {
        return (!isset(self::$context[$name])) ?
                      (self::$context[$name] = new gop_Context($name)) :
                       self::$context[$name];
    }
    private $stack = array();
    public function hasCallee($g) {
        return (!is_int($g)) ? false : ((array_key_exists($g, $this->stack)) ? true : false);
    }
    public function setCallee($g, $c) {$this->stack[$g] = $c;}
    public function getCallee($g) {
        return (!is_int($g)) ? null : ((array_key_exists($g, $this->stack)) ?
                $this->stack[$g] : null);
    }
}
?>